Skip to main content

ValidationContext<T>

Validation context

Assembly: ServiceStack.dll
View Source
Declaration
public class ValidationContext<T> : IValidationContext, ICommonContext

Properties

InstanceToValidate

The object to validate

View Source
Declaration
public T InstanceToValidate { get; }

RootContextData

Additional data associated with the validation request.

View Source
Declaration
public IDictionary<string, object> RootContextData { get; }

PropertyChain

Property chain

View Source
Declaration
public PropertyChain PropertyChain { get; }

ICommonContext.InstanceToValidate

Object being validated

View Source
Declaration
object ICommonContext.InstanceToValidate { get; }

Selector

Selector

View Source
Declaration
public IValidatorSelector Selector { get; }

IsChildContext

Whether this is a child context

View Source
Declaration
public virtual bool IsChildContext { get; }

IsChildCollectionContext

Whether this is a child collection context.

View Source
Declaration
public virtual bool IsChildCollectionContext { get; }

ICommonContext.PropertyValue

View Source
Declaration
object ICommonContext.PropertyValue { get; }

ICommonContext.ParentContext

View Source
Declaration
ICommonContext ICommonContext.ParentContext { get; }

ThrowOnFailures

Whether the root validator should throw an exception when validation fails. Defaults to false.

View Source
Declaration
public bool ThrowOnFailures { get; }

Request

View Source
Declaration
public IRequest Request { get; set; }

Methods

CreateWithOptions(T, Action<ValidationStrategy<T>>)

Creates a new validation context using the specified options.

View Source
Declaration
public static ValidationContext<T> CreateWithOptions(T instanceToValidate, Action<ValidationStrategy<T>> options)
Returns

ServiceStack.FluentValidation.ValidationContext<T>

Parameters
TypeNameDescription
<T>instanceToValidateThe instance to validate

| | System.Action<ServiceStack.FluentValidation.Internal.ValidationStrategy<<T>>> | options | Callback that allows extra options to be configured.

|

GetFromNonGenericContext(IValidationContext)

Gets or creates generic validation context from non-generic validation context.

View Source
Declaration
public static ValidationContext<T> GetFromNonGenericContext(IValidationContext context)
Returns

ServiceStack.FluentValidation.ValidationContext<T>

Parameters
TypeName
ServiceStack.FluentValidation.IValidationContextcontext

CloneForChildValidator<TChild>(TChild, Boolean, IValidatorSelector)

Creates a new validation context for use with a child validator

View Source
Declaration
public ValidationContext<TChild> CloneForChildValidator<TChild>(TChild instanceToValidate, bool preserveParentContext = false, IValidatorSelector selector = null)
Returns

ServiceStack.FluentValidation.ValidationContext<T>

Parameters
TypeName
<TChild>instanceToValidate
System.BooleanpreserveParentContext
ServiceStack.FluentValidation.Internal.IValidatorSelectorselector
Type Parameters
  • TChild

CloneForChildCollectionValidator<TNew>(TNew, Boolean)

Creates a new validation context for use with a child collection validator

View Source
Declaration
public ValidationContext<TNew> CloneForChildCollectionValidator<TNew>(TNew instanceToValidate, bool preserveParentContext = false)
Returns

ServiceStack.FluentValidation.ValidationContext<T>

Parameters
TypeName
<TNew>instanceToValidate
System.BooleanpreserveParentContext
Type Parameters
  • TNew

Implements